import Vue from 'vue'
import VueRouter from 'vue-router'
const LoginPage = () => import("../views/LoginPage.vue");
const RegisterPage = () => import("../views/RegisterPage.vue");
const IndexPage = () => import("../views/IndexPage.vue");
const ArticleListHomePage = () => import("../views/ArticleListHomePage.vue");
const CategoryListHomePage = () => import("../views/CategoryListHomePage.vue");
const UserPage = () => import("../views/UserPage.vue");
const UserInfoPage = () => import("../views/UserInfoPage.vue");
const HomePage = () => import("../views/HomePage.vue");
const MessagePage = () => import("../views/MessagePage.vue");
const SettingPage = () => import("../views/SettingPage.vue");

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: LoginPage
  },
  {
    path: '/register',
    name: 'register',
    component: RegisterPage
  },
  {
    path: '/index',
    name: 'index',
    component: IndexPage,
    redirect: '/home',
    children:[
      {
        path: '/home',
        component: HomePage,
        default: true,
        children:[
          {
            path: '/article',
            name: 'article',
            component: ArticleListHomePage,
          },
          {
            path: '/category',
            name: 'category',
            component: CategoryListHomePage
          },
        ]
      },
      {
        path: '/msg',
        name: 'msg',
        component: MessagePage
      },
      {
        path: '/user',
        name: 'user',
        component: UserPage
      },
    ]
  },
  {
    path: '/userInfo',
    name: 'userInfo',
    component: UserInfoPage
  },
  {
    path: '/setting',
    name: 'setting',
    component: SettingPage
  }
]

const router = new VueRouter({
  routes
})

export default router
